package JDK8New;

import org.junit.Test;

import java.util.Comparator;

/*
* lamba表达式主要作用:优化代码
*
*
* */
public class TestLamba {
     @Test
    public void test1(){
         Comparator<Integer> com1=new Comparator<Integer>() {
             @Override
             public int compare(Integer o1, Integer o2) {
                 return o1.compareTo(o2);
             }
         };
         System.out.println(com1.compare(12,23));

         Comparator<Integer> com2=(o1, o2) -> {return o1.compareTo(o2);};
         System.out.println(com2.compare(34,23));

     }

}
